<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="css/jquery.min.js"></script>
	</head>
	<body>
		<h1>解析京东获取商品价格的json字符串</h1>
		<div>
			商品的编号:<span id="id"></span>
		</div>
		<div>
			商品的价格:<span id="price"></span>
		</div>
	</body>
	<script>
		var jsonstr='[{"p":"5999.00","op":"5999.00","cbf":"0","id":"J_100009077449","m":"6499.00"}]';
		var jsonobj=JSON.parse(jsonstr);
		var rs = jsonobj[0]
		var price = rs.p;
		console.log(price);
		var id = rs.id.substring(2);
		console.log(id);
		
		$("#id").text(id);
		$("#id").css("color","blue");
		$("#price").text(price);
		$("#price").css("color","red");
	</script>
</html>
